{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id = Section1> </a>\n",
    "## 高数上38-39页笔记整理"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id = Section1> </a>\n",
    "## 定理1：两个无穷小的和是无穷小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "import sympy\n",
    "# 定义变量\n",
    "x = sympy.Symbol('x')\n",
    "# 定义两个函数，这里简单示例为1/x和2/x，当x趋于无穷时，它们都是无穷小量\n",
    "func1 = 1 / x\n",
    "func2 = 2 / x\n",
    "# 求两个函数和的极限，这里极限过程是x趋于正无穷\n",
    "sum_func = func1 + func2\n",
    "limit_result = sympy.limit(sum_func, x, sympy.oo)\n",
    "print(limit_result)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id = Section1> </a>\n",
    "## 定理2：有界函数与无穷小的乘机是无穷小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "import sympy\n",
    "# 定义变量\n",
    "x = sympy.Symbol('x')\n",
    "# 定义一个有界函数示例，这里简单假设是sin(x)，它的值域是[-1, 1]，是有界的\n",
    "bounded_func = sympy.sin(x)\n",
    "# 定义一个无穷小量的函数示例，比如 1/x，当x趋于无穷时它是无穷小\n",
    "infinitesimal_func = 1 / x\n",
    "# 求它们乘积的极限，这里求极限过程是x趋于正无穷\n",
    "product_func = bounded_func * infinitesimal_func\n",
    "limit_result = sympy.limit(product_func, x, sympy.oo)\n",
    "print(limit_result)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id = Section1> </a>\n",
    "## 定理3：如果limf(x)=A,limg(x)=B,那么lim[f(x)*g(x)]=limf(x)*limg(x)=A*B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lim[f(x)*g(x)]: 0\n",
      "limf(x)*limg(x): 0\n"
     ]
    }
   ],
   "source": [
    "import sympy\n",
    "# 定义变量\n",
    "x = sympy.Symbol('x')\n",
    "# 定义函数f(x)和它的极限值A，这里简单举例，比如f(x) = (2*x + 1)，极限过程x趋于1时极限A为3\n",
    "f = 2 * x + 1\n",
    "A = 3\n",
    "# 定义函数g(x)和它的极限值B，例如g(x) = (x - 1)，极限过程x趋于1时极限B为0\n",
    "g = x - 1\n",
    "B = 0\n",
    "# 分别求f(x)*g(x)的极限以及A*B的值并对比\n",
    "product_func = f * g\n",
    "limit_result = sympy.limit(product_func, x, 1)\n",
    "print(\"lim[f(x)*g(x)]:\", limit_result)\n",
    "print(\"limf(x)*limg(x):\", A * B)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id = Section1> </a>\n",
    "## 推论1:常数与无穷小的乘积是无穷小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "import sympy\n",
    "# 定义变量\n",
    "x = sympy.Symbol('x')\n",
    "# 定义常数，这里以常数3为例\n",
    "constant = 3\n",
    "# 定义一个无穷小量的函数示例，比如 1/x，当x趋于无穷时它是无穷小\n",
    "infinitesimal_func = 1 / x\n",
    "# 求它们乘积的函数\n",
    "product_func = constant * infinitesimal_func\n",
    "# 求乘积函数在x趋于正无穷时的极限\n",
    "limit_result = sympy.limit(product_func, x, sympy.oo)\n",
    "print(limit_result)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id = Section1> </a>\n",
    "## 推论2：有限个无穷小的乘积是无穷小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "   import sympy\n",
    "   # 定义变量x\n",
    "   x = sympy.Symbol('x')\n",
    "   # 定义两个无穷小函数示例，例如1/x和1/(x + 1)，当x趋于正无穷时它们是无穷小\n",
    "   infinitesimal1 = 1/x\n",
    "   infinitesimal2 = 1/(x + 1)\n",
    "   # 求它们乘积的极限，极限过程为x趋于正无穷\n",
    "   product_func = infinitesimal1 * infinitesimal2\n",
    "   limit_result = sympy.limit(product_func, x, sympy.oo)\n",
    "   print(limit_result)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
